home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / Source.bin / SplitterPanelBeanInfo.java < prev    next >
Text File  |  1998-08-21  |  16KB  |  411 lines

  1. package symantec.itools.awt;
  2.  
  3. import java.beans.*;
  4. import symantec.itools.beans.*;
  5. import java.util.ResourceBundle;
  6.  
  7. //  07/17/97    LAB    Changed constrained property of gapColor to true. Changed constrained property
  8. //                    of enforceMinDim to true.  Changed constrained property of propResize to true.
  9. //                    Added use3DBorder property.  Added allowDynamicMoving property.  Updated boolean
  10. //                    get<PropertyName> to is<PropertyName> for enforceMinDim and propResize.  Added
  11. //                    toggle connections for enforceMinDim and propResize.  Added toggle, set, is and
  12. //                    is not connections for use3DBorder and allowDynamicMoving properties.
  13. //  09/07/97    LAB    Fixed misspelling of descriptions.
  14. //  09/11/97    LAB    Hid layout property (Addresses Mac Bug #7610).
  15. //  08/19/98    LAB    Moved to GroupAWTAdditions folder.
  16.  
  17. /**
  18.  * BeanInfo for SplitterPanel.
  19.  *
  20.  */
  21. public class SplitterPanelBeanInfo extends SimpleBeanInfo {
  22.  
  23.     /**
  24.      * Constructs a SplitterPanelBeanInfo object.
  25.      */
  26.     public SplitterPanelBeanInfo() {
  27.     }
  28.  
  29.     /**
  30.      * Gets a BeanInfo for the superclass of this bean.
  31.      * @return BeanInfo[] containing this bean's superclass BeanInfo
  32.      */
  33.     public BeanInfo[] getAdditionalBeanInfo() {
  34.         try {
  35.             BeanInfo[] bi = new BeanInfo[1];
  36.             bi[0] = Introspector.getBeanInfo(beanClass.getSuperclass());
  37.             return bi;
  38.         }
  39.         catch (IntrospectionException e) { throw new Error(e.toString());}
  40.     }
  41.  
  42.     /**
  43.      * Gets the SymantecBeanDescriptor for this bean.
  44.      * @return an object of type SymantecBeanDescriptor
  45.      * @see symantec.itools.beans.SymantecBeanDescriptor
  46.      */
  47.     public BeanDescriptor getBeanDescriptor() {
  48.         ResourceBundle group = ResourceBundle.getBundle("symantec.itools.resources.GroupBundle");
  49.         String s=group.getString("GroupAWTAdditions"); 
  50.  
  51.         SymantecBeanDescriptor bd = new SymantecBeanDescriptor(beanClass);
  52.         bd.setFolder(s);
  53.         bd.setWinHelp("0x123BA");
  54.  
  55.         return (BeanDescriptor) bd;
  56.     }
  57.  
  58.     /**
  59.      * Gets an image that may be used to visually represent this bean
  60.      * (in the toolbar, on a form, etc).
  61.      * @param iconKind the type of icon desired, one of: BeanInfo.ICON_MONO_16x16,
  62.      * BeanInfo.ICON_COLOR_16x16, BeanInfo.ICON_MONO_32x32, or BeanInfo.ICON_COLOR_32x32.
  63.      * @return an image for this bean, always color even if requested monochrome
  64.      * @see BeanInfo#ICON_MONO_16x16
  65.      * @see BeanInfo#ICON_COLOR_16x16
  66.      * @see BeanInfo#ICON_MONO_32x32
  67.      * @see BeanInfo#ICON_COLOR_32x32
  68.      */
  69.     public java.awt.Image getIcon(int iconKind) {
  70.         if (iconKind == BeanInfo.ICON_MONO_16x16 ||
  71.             iconKind == BeanInfo.ICON_COLOR_16x16) {
  72.             java.awt.Image img = loadImage("SplitterPanelC16.gif");
  73.             return img;
  74.         }
  75.  
  76.         if (iconKind == BeanInfo.ICON_MONO_32x32 ||
  77.             iconKind == BeanInfo.ICON_COLOR_32x32) {
  78.             java.awt.Image img = loadImage("SplitterPanelC32.gif");
  79.             return img;
  80.         }
  81.  
  82.         return null;
  83.     }
  84.  
  85.     /**
  86.      * Gets an array of descriptions of the methods used for "connections" by
  87.      * Visual CafΘ's Interaction Wizard.
  88.      * Included in each method description is a CONNECTIONS ConnectionDescriptor.
  89.      * @return method descriptions for this bean
  90.      * @see symantec.itools.beans.ConnectionDescriptor#CONNECTIONS
  91.      */
  92.     public MethodDescriptor[] getMethodDescriptors() {
  93.         Class[] args;
  94.         ConnectionDescriptor connection;
  95.         java.util.Vector connections;
  96.         java.util.Vector md = new java.util.Vector();
  97.         ResourceBundle conn = ResourceBundle.getBundle("symantec.itools.resources.ConnBundle");
  98.  
  99.         try{
  100.             args = null;
  101.             MethodDescriptor isEnforceMinDim = new MethodDescriptor(beanClass.getMethod("isEnforceMinDim", args));
  102.  
  103.             connections = new java.util.Vector();
  104.             connection = new ConnectionDescriptor("output", "boolean", "",
  105.                                     "%name%.isEnforceMinDim()",
  106.                                     conn.getString("isEnforceMinDim"));
  107.             connections.addElement(connection);
  108.  
  109.             connection = new ConnectionDescriptor("output", "boolean", "",
  110.                                     "!%name%.isEnforceMinDim()",
  111.                                     conn.getString("isNotEnforceMinDim"));
  112.             connections.addElement(connection);
  113.  
  114.             isEnforceMinDim.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  115.             md.addElement(isEnforceMinDim);
  116.         } catch (Exception e) { throw new Error("isEnforceMinDim:: " + e.toString()); }
  117.  
  118.         try{
  119.             args = new Class[1];
  120.             args[0] = java.lang.Integer.TYPE ;
  121.             MethodDescriptor setGapSizes = new MethodDescriptor(beanClass.getMethod("setGapSizes", args));
  122.  
  123.             connections = new java.util.Vector();
  124.             connection = new ConnectionDescriptor("input", "int", "",
  125.                                     "%name%.setGapSizes(%arg%);",
  126.                                     conn.getString("setGapSizes"));
  127.             connections.addElement(connection);
  128.  
  129.             setGapSizes.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  130.             md.addElement(setGapSizes);
  131.         } catch (Exception e) { throw new Error("setGapSizes:: " + e.toString()); }
  132.  
  133.         try{
  134.             args = null;
  135.             MethodDescriptor iBdrSize = new MethodDescriptor(beanClass.getMethod("iBdrSize", args));
  136.  
  137.             connections = new java.util.Vector();
  138.             connection = new ConnectionDescriptor("output", "int", "",
  139.                                     "%name%.iBdrSize()",
  140.                                     conn.getString("iBdrSize"));
  141.             connections.addElement(connection);
  142.  
  143.             iBdrSize.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  144.             md.addElement(iBdrSize);
  145.         } catch (Exception e) { throw new Error("iBdrSize:: " + e.toString()); }
  146.  
  147.         try{
  148.             args = null;
  149.             MethodDescriptor isPropResize = new MethodDescriptor(beanClass.getMethod("isPropResize", args));
  150.  
  151.             connections = new java.util.Vector();
  152.             connection = new ConnectionDescriptor("output", "boolean", "",
  153.                                     "%name%.isPropResize()",
  154.                                     conn.getString("isPropResize"));
  155.             connections.addElement(connection);
  156.  
  157.             connection = new ConnectionDescriptor("output", "boolean", "",
  158.                                     "!%name%.getPropResize()",
  159.                                     conn.getString("getPropResize"));
  160.             connections.addElement(connection);
  161.  
  162.             isPropResize.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  163.             md.addElement(isPropResize);
  164.         } catch (Exception e) { throw new Error("isPropResize:: " + e.toString()); }
  165.  
  166.         try{
  167.             args = null;
  168.             MethodDescriptor oBdrSize = new MethodDescriptor(beanClass.getMethod("oBdrSize", args));
  169.  
  170.             connections = new java.util.Vector();
  171.             connection = new ConnectionDescriptor("output", "int", "",
  172.                                     "%name%.oBdrSize()",
  173.                                     conn.getString("oBdrSize"));
  174.             connections.addElement(connection);
  175.  
  176.             oBdrSize.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  177.             md.addElement(oBdrSize);
  178.         } catch (Exception e) { throw new Error("oBdrSize:: " + e.toString()); }
  179.  
  180.         try{
  181.             args = new Class[1];
  182.             args[0] = java.lang.Boolean.TYPE ;
  183.             MethodDescriptor setEnforceMinDim = new MethodDescriptor(beanClass.getMethod("setEnforceMinDim", args));
  184.  
  185.             connections = new java.util.Vector();
  186.             connection = new ConnectionDescriptor("input", "boolean", "",
  187.                                     "%name%.setEnforceMinDim(%arg%);",
  188.                                     conn.getString("setEnforceMinDimValue"));
  189.             connections.addElement(connection);
  190.  
  191.             connection = new ConnectionDescriptor("input", "void", "",
  192.                                     "%name%.setEnforceMinDim(!%name%.isEnforceMinDim());",
  193.                                     conn.getString("setEnforceMinDimToggle"));
  194.             connections.addElement(connection);
  195.  
  196.             setEnforceMinDim.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  197.             md.addElement(setEnforceMinDim);
  198.         } catch (Exception e) { throw new Error("setEnforceMinDim:: " + e.toString()); }
  199.  
  200.         try{
  201.             args = null;
  202.             MethodDescriptor getGapColor = new MethodDescriptor(beanClass.getMethod("getGapColor", args));
  203.  
  204.             connections = new java.util.Vector();
  205.             connection = new ConnectionDescriptor("output", "Color", "",
  206.                                     "%name%.getGapColor()",
  207.                                     conn.getString("getGapColor"));
  208.             connections.addElement(connection);
  209.  
  210.             getGapColor.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  211.             md.addElement(getGapColor);
  212.         } catch (Exception e) { throw new Error("getGapColor:: " + e.toString()); }
  213.  
  214.         try{
  215.             args = new Class[1];
  216.             args[0] = java.awt.Color.class ;
  217.             MethodDescriptor setGapColor = new MethodDescriptor(beanClass.getMethod("setGapColor", args));
  218.  
  219.             connections = new java.util.Vector();
  220.             connection = new ConnectionDescriptor("input", "Color", "",
  221.                                     "%name%.setGapColor(%arg%);",
  222.                                     conn.getString("setGapColor"));
  223.             connections.addElement(connection);
  224.  
  225.             setGapColor.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  226.             md.addElement(setGapColor);
  227.         } catch (Exception e) { throw new Error("setGapColor:: " + e.toString()); }
  228.  
  229.         try{
  230.             args = new Class[1];
  231.             args[0] = java.lang.Integer.TYPE ;
  232.             MethodDescriptor setBdrSizes = new MethodDescriptor(beanClass.getMethod("setBdrSizes", args));
  233.  
  234.             connections = new java.util.Vector();
  235.             connection = new ConnectionDescriptor("input", "int", "",
  236.                                     "%name%.setBdrSizes(%arg%);",
  237.                                     conn.getString("setBdrSizes"));
  238.             connections.addElement(connection);
  239.  
  240.             setBdrSizes.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  241.             md.addElement(setBdrSizes);
  242.         } catch (Exception e) { throw new Error("setBdrSizes:: " + e.toString()); }
  243.  
  244.         try{
  245.             args = new Class[1];
  246.             args[0] = java.lang.Boolean.TYPE ;
  247.             MethodDescriptor setPropResize = new MethodDescriptor(beanClass.getMethod("setPropResize", args));
  248.  
  249.             connections = new java.util.Vector();
  250.             connection = new ConnectionDescriptor("input", "boolean", "",
  251.                                     "%name%.setPropResize(%arg%);",
  252.                                     conn.getString("setPropResizeValue"));
  253.             connections.addElement(connection);
  254.  
  255.             connection = new ConnectionDescriptor("input", "void", "",
  256.                                     "%name%.setPropResize(!%name%.isPropResize());",
  257.                                     conn.getString("setPropResizeToggle"));
  258.             connections.addElement(connection);
  259.  
  260.             setPropResize.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  261.             md.addElement(setPropResize);
  262.         } catch (Exception e) { throw new Error("setPropResize:: " + e.toString()); }
  263.  
  264.         try{
  265.             args = null;
  266.             MethodDescriptor removeAll = new MethodDescriptor(beanClass.getMethod("removeAll", args));
  267.  
  268.             connections = new java.util.Vector();
  269.             connection = new ConnectionDescriptor("input", "void", "",
  270.                                     "%name%.removeAll();",
  271.                                     conn.getString("removeAll"));
  272.             connections.addElement(connection);
  273.  
  274.             removeAll.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  275.             md.addElement(removeAll);
  276.         } catch (Exception e) { throw new Error("removeAll:: " + e.toString()); }
  277.  
  278.         try{
  279.             args = new Class[1];
  280.             args[0] = java.lang.Boolean.TYPE ;
  281.             MethodDescriptor setUse3DBorder = new MethodDescriptor(beanClass.getMethod("setUse3DBorder", args));
  282.  
  283.             connections = new java.util.Vector();
  284.             connection = new ConnectionDescriptor("input", "void", "",
  285.                                     "%name%.setUse3DBorder(!%name%.isUse3DBorder());",
  286.                                     conn.getString("setUse3DBorderToggle"));
  287.             connections.addElement(connection);
  288.  
  289.             connection = new ConnectionDescriptor("input", "boolean", "",
  290.                                     "%name%.setUse3DBorder(%arg%);",
  291.                                     conn.getString("setUse3DBorderValue"));
  292.             connections.addElement(connection);
  293.  
  294.             setUse3DBorder.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  295.             md.addElement(setUse3DBorder);
  296.         } catch (Exception e) { throw new Error("setUse3DBorder:: " + e.toString()); }
  297.  
  298.         try{
  299.             args = null;
  300.             MethodDescriptor isUse3DBorder = new MethodDescriptor(beanClass.getMethod("isUse3DBorder", args));
  301.  
  302.             connections = new java.util.Vector();
  303.             connection = new ConnectionDescriptor("output", "boolean", "",
  304.                                     "%name%.isUse3DBorder()",
  305.                                     conn.getString("isUse3DBorder"));
  306.             connections.addElement(connection);
  307.  
  308.             connection = new ConnectionDescriptor("output", "boolean", "",
  309.                                     "!%name%.isUse3DBorder()",
  310.                                     conn.getString("isNotUse3DBorder"));
  311.             connections.addElement(connection);
  312.  
  313.             isUse3DBorder.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  314.             md.addElement(isUse3DBorder);
  315.         } catch (Exception e) { throw new Error("isUse3DBorder:: " + e.toString()); }
  316.  
  317.  
  318.         try{
  319.             args = new Class[1];
  320.             args[0] = java.lang.Boolean.TYPE ;
  321.             MethodDescriptor setAllowDynamicMoving = new MethodDescriptor(beanClass.getMethod("setAllowDynamicMoving", args));
  322.  
  323.             connections = new java.util.Vector();
  324.             connection = new ConnectionDescriptor("input", "void", "",
  325.                                     "%name%.setAllowDynamicMoving(!%name%.isAllowDynamicMoving());",
  326.                                     conn.getString("setAllowDynamicMovingToggle"));
  327.             connections.addElement(connection);
  328.  
  329.             connection = new ConnectionDescriptor("input", "boolean", "",
  330.                                     "%name%.setAllowDynamicMoving(%arg%);",
  331.                                     conn.getString("setAllowDynamicMovingValue"));
  332.             connections.addElement(connection);
  333.  
  334.             setAllowDynamicMoving.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  335.             md.addElement(setAllowDynamicMoving);
  336.         } catch (Exception e) { throw new Error("setAllowDynamicMoving:: " + e.toString()); }
  337.  
  338.         try{
  339.             args = null;
  340.             MethodDescriptor isAllowDynamicMoving = new MethodDescriptor(beanClass.getMethod("isAllowDynamicMoving", args));
  341.  
  342.             connections = new java.util.Vector();
  343.             connection = new ConnectionDescriptor("output", "boolean", "",
  344.                                     "%name%.isAllowDynamicMoving()",
  345.                                     conn.getString("isAllowDynamicMoving"));
  346.             connections.addElement(connection);
  347.  
  348.             connection = new ConnectionDescriptor("output", "boolean", "",
  349.                                     "!%name%.isAllowDynamicMoving()",
  350.                                     conn.getString("isNotAllowDynamicMoving"));
  351.             connections.addElement(connection);
  352.  
  353.             isAllowDynamicMoving.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  354.             md.addElement(isAllowDynamicMoving);
  355.         } catch (Exception e) { throw new Error("isAllowDynamicMoving:: " + e.toString()); }
  356.  
  357.         MethodDescriptor[] rv = new MethodDescriptor[md.size()];
  358.         md.copyInto(rv);
  359.  
  360.         return rv;
  361.     }
  362.  
  363.     /**
  364.      * Returns descriptions of this bean's properties.
  365.      */
  366.     public PropertyDescriptor[] getPropertyDescriptors() {
  367.         ResourceBundle prop = ResourceBundle.getBundle("symantec.itools.resources.PropBundle");
  368.  
  369.         try{
  370.         PropertyDescriptor gapColor = new PropertyDescriptor("gapColor", beanClass);
  371.         gapColor.setBound(true);
  372.         gapColor.setConstrained(true);
  373.         gapColor.setDisplayName(prop.getString("gapColor"));
  374.  
  375.         PropertyDescriptor enforceMinDim = new PropertyDescriptor("enforceMinDim", beanClass);
  376.         enforceMinDim.setBound(true);
  377.         enforceMinDim.setConstrained(true);
  378.         enforceMinDim.setDisplayName(prop.getString("enforceMinDim"));
  379.  
  380.         PropertyDescriptor propResize = new PropertyDescriptor("propResize", beanClass);
  381.         propResize.setBound(true);
  382.         propResize.setConstrained(true);
  383.         propResize.setDisplayName(prop.getString("propResize"));
  384.  
  385.         PropertyDescriptor use3DBorder = new PropertyDescriptor("use3DBorder", beanClass);
  386.         use3DBorder.setBound(true);
  387.         use3DBorder.setConstrained(true);
  388.         use3DBorder.setDisplayName(prop.getString("use3DBorder"));
  389.  
  390.         PropertyDescriptor allowDynamicMoving = new PropertyDescriptor("allowDynamicMoving", beanClass);
  391.         allowDynamicMoving.setBound(true);
  392.         allowDynamicMoving.setConstrained(true);
  393.         allowDynamicMoving.setDisplayName(prop.getString("allowDynamicMoving"));
  394.  
  395.         PropertyDescriptor layout = new PropertyDescriptor("layout", beanClass);
  396.         layout.setHidden(true);
  397.  
  398.         PropertyDescriptor[] rv = {
  399.             gapColor,
  400.             enforceMinDim,
  401.             propResize,
  402.             use3DBorder,
  403.             allowDynamicMoving,
  404.             layout};
  405.         return rv;
  406.         } catch (IntrospectionException e) { throw new Error(e.toString()); }
  407.     }
  408.  
  409.     private final static Class beanClass = SplitterPanel.class;
  410.  
  411.     }    //  end of class SplitterPanelBeanInfo